package it.polimi.traveldream.entities;

import it.polimi.traveldream.TransportDTO;

import java.io.Serializable;

import javax.persistence.*;

import java.sql.Time;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the transport database table.
 * 
 */
@Entity
@NamedQuery(name="Transport.findAll", query="SELECT t FROM Transport t")
public class Transport implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	private String cittaArrivo;

	private String cittaPartenza;

	@Temporal(TemporalType.TIMESTAMP)
	private Date dataPartenza;

	private double durata;

	private int frequenza;

	private String nome;

	private int nPosti;


	private double prezzo;

	//bi-directional many-to-one association to Custompackage
	/*@OneToMany(mappedBy="transport1")
	private List<Custompackage> custompackages1;

	//bi-directional many-to-one association to Custompackage
	@OneToMany(mappedBy="transport2")
	private List<Custompackage> custompackages2;*/

	//bi-directional many-to-many association to Package
	//@ManyToMany
	//private List<PackageBase> packages;
	
	/*@ManyToMany(mappedBy="transportsritorno")
	private List<PackageBase> packages1;*/
 	
	
	/////// metodi

	public Transport() {
	}

	public Transport(TransportDTO transportDTO){
		super();
		this.cittaArrivo=transportDTO.getCittaArrivo();
		this.cittaPartenza=transportDTO.getCittaPartenza();
		this.dataPartenza=transportDTO.getDataPartenza();
		this.durata=transportDTO.getDurata();
		this.frequenza=transportDTO.getFrequenza();
		this.nome=transportDTO.getNome();
		this.nPosti=transportDTO.getNPosti();
		this.prezzo=transportDTO.getPrezzo();
	}
	
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCittaArrivo() {
		return this.cittaArrivo;
	}

	public void setCittaArrivo(String cittaArrivo) {
		this.cittaArrivo = cittaArrivo;
	}

	public String getCittaPartenza() {
		return this.cittaPartenza;
	}

	public void setCittaPartenza(String cittaPartenza) {
		this.cittaPartenza = cittaPartenza;
	}

	public Date getDataPartenza() {
		return this.dataPartenza;
	}

	public void setDataPartenza(Date dataPartenza) {
		this.dataPartenza = dataPartenza;
	}

	public double getDurata() {
		return this.durata;
	}

	public void setDurata(double durata) {
		this.durata = durata;
	}

	public int getFrequenza() {
		return this.frequenza;
	}

	public void setFrequenza(int frequenza) {
		this.frequenza = frequenza;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public int getNPosti() {
		return this.nPosti;
	}

	public void setNPosti(int nPosti) {
		this.nPosti = nPosti;
	}

	public double getPrezzo() {
		return this.prezzo;
	}

	public void setPrezzo(double prezzo) {
		this.prezzo = prezzo;
	}

	/*public List<Custompackage> getCustompackages1() {
		return this.custompackages1;
	}

	public void setCustompackages1(List<Custompackage> custompackages1) {
		this.custompackages1 = custompackages1;
	}

	public Custompackage addCustompackages1(Custompackage custompackages1) {
		getCustompackages1().add(custompackages1);
		custompackages1.setTransport1(this);

		return custompackages1;
	}

	public Custompackage removeCustompackages1(Custompackage custompackages1) {
		getCustompackages1().remove(custompackages1);
		custompackages1.setTransport1(null);

		return custompackages1;
	}*/

	/*public List<Custompackage> getCustompackages2() {
		return this.custompackages2;
	}

	public void setCustompackages2(List<Custompackage> custompackages2) {
		this.custompackages2 = custompackages2;
	}

	public Custompackage addCustompackages2(Custompackage custompackages2) {
		getCustompackages2().add(custompackages2);
		custompackages2.setTransport2(this);

		return custompackages2;
	}

	public Custompackage removeCustompackages2(Custompackage custompackages2) {
		getCustompackages2().remove(custompackages2);
		custompackages2.setTransport2(null);

		return custompackages2;
	}

	public List<Package> getPackages() {
		return this.packages;
	}

	public void setPackages(List<Package> packages) {
		this.packages = packages;
	}*/

}